package com.itheima.ms.controller;

import com.itheima.ms.pojo.BizUser;
import com.itheima.ms.service.TransferService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *
 */
@RestController
@RequestMapping("transfer")
public class TransferController {

    @Autowired
    private TransferService transferService;

    @RequestMapping("/users")
    public List<BizUser> findAllUser(){
        return transferService.findUsers();
    }

    @RequestMapping("/insert")
    public String insertUser(@RequestBody BizUser user){
        transferService.insertUser(user);
        return "ACK";
    }

    @RequestMapping("/update")
    public String updateUser(@RequestBody BizUser user){
        transferService.updateUser(user);
        return "ACK";
    }
}
